package org.rain.core.storage;

import org.rain.common.util.storage.F;
import org.rain.common.util.storage.IFileStorageService;
import org.rain.common.util.storage.support.LocalFileStorageServiceImpl;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Map;

/**
 * created by yangtong on 2025/4/11 22:18:20
 * <br/>
 * 文件存储配置
 */
@Configuration
public class StorageConfig {

    @Bean
    public IFileStorageService create(FileStorageProperty fileStorageProperty) {
        Map<String, String> config = fileStorageProperty.getConfig();
        LocalFileStorageServiceImpl localFileStorageService = new LocalFileStorageServiceImpl(config.get("path"));
        F.register(localFileStorageService);
        return localFileStorageService;
    }

}
